﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="StsAdminCommand.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
//   
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Collaboris.Saf.Actions.Wss.Entities
{
    using System;

    using SharePoint.Wss.Attributes;
    using SharePoint.Wss.Entities;

    using Utils;

    [Serializable]
    [CollaborisClass(
       Title = "StsAdmin Command",
       ReleaseStatus = ReleaseStatus.Stable,
       DisableDocumentation = false,
       ContactAuthorEmail = "Support@Collaboris.co.uk",
       Summary = "This class collates information about the name of the StsAdm operation and the arguments/parameters that will be passed to it.",
       Remarks = "Use this class when you wish to support the StsAdmin Action." 
     )]
    public class StsAdminCommand : WSSEntityBase
    {
        /// <summary>
        /// the url of the site to process the file upon
        /// </summary>
        private SerializableStringDictionary arguments = new SerializableStringDictionary();

        private string operation;

        [CollaborisProperty(
         Summary = "Defines a dictionary of arguments that are passed in for the given operation.",
         Title = "StsAdm Arguments",
         Required = true,
         Example = @"<dictionary>" +
					    @"<entry key=""url"" value=""${CurrentWeb.Url}""/>" +
					    @"<entry key=""name"" value=""SAF Demo Group""/>" +
					    @"<entry key=""description"" value=""This is a group created by SAF""/>" +
					    @"<entry key=""ownerlogin"" value=""${CurrentUser}""/>" +
					    @"<entry key=""type"" value=""owner""/>" +
				    @"</dictionary>"
         )]
        public SerializableStringDictionary Arguments
        {
            get
            {
                return this.arguments;
            }

            set
            {
                this.arguments = value;
            }
        }

        [CollaborisProperty(
         Summary = "The StsAdm Operation that will be run.",
         Title = "StsAdm Operation / Command",
         Required = true,
         Remarks = "This operation should match the '-o [operation] that is used " + 
                   "from a command line when using stsadm.",
         Example = @"creategroup" 
         )]
        public string Operation
        {
            get
            {
                return this.operation;
            }

            set
            {
                this.operation = value;
            }
        }
    }
}
